#include<iostream>
using namespace std;
class A
{
public:
	A()
	{
		cout << "A()" << endl;
	}
	virtual ~A()
	{
		cout << "~A()" << endl;
	}
};
class B:public A
{
public:
	B()
	{
		cout << "B()" << endl;
		p = new int[10];
	}
	~B()
	{
		cout << "~B()" << endl;
		delete p;
	}
private:
	int* p;
};
int main()
{
	A* a = new B();
	delete a;
	return 0;
}